<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript" charset="utf-8">
			var zhangsan={
				name:"张三",
				age:22,
				sex:"男",
				say:function  () {
					console.log("我的名字叫："+this.name+"，年龄"+this.age)
				},
				reg:/abc/,
				time:new Date(),
				aihao:["羽毛球","羽毛球","羽毛球"]
			}
			var zs=JSON.stringify(zhangsan);
			console.log(zs);
			var obj=JSON.parse(zs);
			console.log(obj.age)
			
		</script>
		<script src="json.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			window.onload = function() {
				var all = document.getElementById("sheng"); //省对象
				var city = document.getElementById("shi"); //市
				var qu = document.getElementById("qu"); //区
				
				/*省级联动*/
				for(var i = 0; i < sheng.length; i++) {
					all.appendChild(new Option(sheng[i].name));
					all.onchange=function(){
						if(this.value){
							var index=this.selectedIndex;
							city.options.length=1;
							var shi = sheng[index-1].city;
							/*市级联动*/
							for (var j = 0; j < shi.length; j++) {
								city.appendChild(new Option(shi[j].name));
								city.onchange=function(){
									if(this.value){
										var indexs = this.selectedIndex;
										var qus = shi[indexs-1].area;
										qu.options.length=1;
										/*区级联动*/
										for (var k = 0; k < qus.length; k++) {
											qu.appendChild(new Option(qus[k]));
										}
									}
								}
							}
						}
					}
				}
			}
		</script>
	</head>
	<body>请选择省市区
			
			<select name="" id="sheng">
				<option value="">所在省市</option>
			</select>
			<select name="" id="shi">
				<option value="">所在市区</option>
			</select>
			<select name="" id="qu">
				<option value="">所在区</option>
			</select>
		
	</body>
</html>
